package mvc.service.impl;

import foundation.model.Pagination;
import foundation.service.mybatis.impl.ServiceImpl;
import mvc.dao.AppDao;
import mvc.model.App;
import mvc.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;


@Service("appService")
public class AppServiceImpl extends ServiceImpl<AppDao, App, Integer> implements AppService {
	

	@Autowired
	public void setDao(AppDao dao) {
		this.dao = dao;
	}
	

	public void save(App t) {
		super.save(t);
	}

	@Override
	public void enable(Boolean isEnable, List<Integer> idList) {

	}

	public List<App> findByAll(String name) {
		return dao.findPaginationByName(name, null);
	}

	public Pagination<App> findPaginationByName(String name, Pagination<App> p) {
		dao.findPaginationByName(name, p);
		return p;
	}

	public App findByCode(String code) {
		return dao.findByCode(code);
	}
	
	public List<App> findByUserId(Boolean isEnable, Integer userId) {
		return dao.findByUserId(isEnable, userId);
	}
	

	public Set<String> findAppCodeByUserId(Boolean isEnable, Integer userId) {
		return dao.findAppCodeByUserId(isEnable, userId);
	}
}
